home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
56804
/
56804.xpi
/
chrome
/
content
/
options.js
< prev
next >
Wrap
Text File
|
2010-01-31
|
6KB
|
184 lines
if(!com) var com={};
if(!com.seostatus) com.seostatus={};
com.seostatus.options = function(){
var pub = {};
pub.STBOptions = null;
pub.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
pub.STB_OptionsLoad = function()
{
var topWindow = pub.getTopWindow();
var STB_tools_gb = document.getElementById( "STB_tools_gb");
var STB_tools = topWindow.document.getElementById( "tools_only" );
var isTB_Tools_Hidden = STB_tools.getAttribute("hidden");
if (isTB_Tools_Hidden == "true"){
STB_tools_gb.selectedIndex = 1;
}
else{
STB_tools_gb.selectedIndex = 0;
}
var STB_pr_gb = document.getElementById( "STB_pr_alexa_gb");
var STB_tb_pr = topWindow.document.getElementById( "STB_Meters" );
var isTB_tb_pr_Hidden = STB_tb_pr.getAttribute("hidden");
var STB_sb_PR = topWindow.document.getElementById( "STB_statusbar_meters" );
//STB_sb_PR.setAttribute("hidden", "true");
var isTB_sb_PR_Hidden = STB_sb_PR.getAttribute("hidden");
if (isTB_tb_pr_Hidden == "true" && isTB_sb_PR_Hidden == "true" ){
STB_pr_gb.selectedIndex = 2;
}
else if (isTB_tb_pr_Hidden == "true" && isTB_sb_PR_Hidden != "true" ){
STB_pr_gb.selectedIndex = 1;
}
else{
STB_pr_gb.selectedIndex = 0;
}
//var STB_pr_alexa_gb = document.getElementById( "STB_pr_alexa_gb" );
// STB_pr_alexa_gb.selectedIndex = 0;
//alert(STB_sb_PR.getAttribute("hidden"));
//alert(true);
///////////////////////////// Alexa Tab /////////////////////////////////////
var branch = pub.pref.getBranch("seostatus.");
try
{
document.getElementById("Alexa_Agree").checked = branch.getBoolPref("stb_alexa_agree");
}
catch(e)
{
document.getElementById("Alexa_Agree").checked = true;
}
////////// IF FIRST TIME RUNNING, HAVE ALEXA TAB ACTIVE //////////////
var branch = pub.pref.getBranch("seostatus.");
try{
if (!branch.prefHasUserValue("stb_installDate")){
document.getElementById("stb_options_tab").hidden = "true";
document.getElementById("stb_alexa_tab").hidden = "true";
document.getElementById("stb_options_panel").hidden = "true";
//alert(document.getElementById("stb_options_tab_box").selectedTab);
}
}
catch(e){
alert(e);
}
}
pub.STB_Options_accept = function()
{
var topWindow = pub.getTopWindow();
var branch = pub.pref.getBranch("seostatus.");
var STB_tools_gb = document.getElementById( "STB_tools_gb");
var STB_tools = topWindow.document.getElementById( "tools_only" );
var isTB_Tools_Hidden = STB_tools.getAttribute("hidden");
//alert("jake");
//alert (STB_tools_gb.selectedIndex);
if (STB_tools_gb.selectedIndex == 1){
STB_tools.setAttribute("hidden", "true");
}
else{
STB_tools.setAttribute("hidden", "false");
}
var STB_pr_gb = document.getElementById( "STB_pr_alexa_gb");
var STB_tb_pr = topWindow.document.getElementById( "STB_Meters" );
var isTB_tb_pr_Hidden = STB_tb_pr.getAttribute("hidden");
var STB_sb_PR = topWindow.document.getElementById( "STB_statusbar_meters" );
var isTB_sb_PR_Hidden = STB_sb_PR.getAttribute("hidden");
// alert(STB_pr_gb.selectedIndex);
if (STB_pr_gb.selectedIndex == 2){
STB_sb_PR.setAttribute("hidden", "true");
STB_tb_pr.setAttribute("hidden", "true");
branch.setBoolPref("stb_hide_the_meters", true);
}
else if(STB_pr_gb.selectedIndex == 1){
STB_sb_PR.setAttribute("hidden", "false");
STB_tb_pr.setAttribute("hidden", "true");
branch.setBoolPref("stb_hide_the_meters", false);
}
else{
STB_sb_PR.setAttribute("hidden", "true");
STB_tb_pr.setAttribute("hidden", "false");
branch.setBoolPref("stb_hide_the_meters", false);
}
//check if both meters and toolbar are hidden
if ( (STB_pr_gb.selectedIndex == 2 && STB_tools_gb.selectedIndex == 1) || (STB_pr_gb.selectedIndex == 1 && STB_tools_gb.selectedIndex == 1)){
var STB_main_toolbar = topWindow.document.getElementById( "SEOTB-Toolbar" );
STB_main_toolbar.setAttribute("hidden", "true");
}
else{
var STB_main_toolbar = topWindow.document.getElementById( "SEOTB-Toolbar" );
STB_main_toolbar.setAttribute("hidden", "false");
}
///////////////////////////// Alexa Tab /////////////////////////////////////
try{
branch.setBoolPref("stb_alexa_agree", document.getElementById("Alexa_Agree").checked);
}
catch(e){}
//alert("hello1");
}
pub.getTopWindow = function()
{
var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator );
var topWindow = windowManagerInterface.getMostRecentWindow( "navigator:browser" );
if( !topWindow )
{
topWindow = window.openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", "about:blank", null, null);
}
return topWindow;
}
pub.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
pub.stb_set_agreement_settings = function()
{
var branch = pub.pref.getBranch("seostatus.");
try
{
document.getElementById("Alexa_Agree").checked = branch.getBoolPref("stb_alexa_agree");
}
catch(e)
{
document.getElementById("Alexa_Agree").checked = true;
}
}
pub.stb_save_agreement_settings = function()
{
var branch = pub.pref.getBranch("seostatus.");
try{
branch.setBoolPref("stb_alexa_agree", document.getElementById("Alexa_Agree").checked);
}
catch(e){}
}
pub.openURLExclude = function(){
window.openDialog( "chrome://seostatus/content/alexaRestrictions.xul", "stb-alexaRestrictedSite-dialog", "centerscreen,chrome,modal" );
}
return pub;
}();